]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Squash together some duplicated code
authorJasper St. Pierre <jstpierre@mecheye.net>
Wed, 28 May 2014 19:18:00 +0000 (15:18 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Mon, 2 Jun 2014 21:39:51 +0000 (17:39 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=731118

js/ui/messageTray.js

index 948a5b88c09670ee3eac261d6eaafe224fa7cf45..971c451a98719965e092df7b2fb65c24eed4da91 100644 (file)
@@ -2268,6 +2268,16 @@ const MessageTray = new Lang.Class({
             this._grabHelper.addActor(corner.actor);
     },
 
+    _resetNotificationLeftTimeout: function() {
+        this._useLongerNotificationLeftTimeout = false;
+        if (this._notificationLeftTimeoutId) {
+            Mainloop.source_remove(this._notificationLeftTimeoutId);
+            this._notificationLeftTimeoutId = 0;
+            this._notificationLeftMouseX = -1;
+            this._notificationLeftMouseY = -1;
+        }
+    },
+
     _onNotificationHoverChanged: function() {
         if (this._notificationWidget.hover == this._notificationHovered)
             return;
@@ -2277,13 +2287,7 @@ const MessageTray = new Lang.Class({
             // No dwell inside notifications at the bottom of the screen
             this._cancelTrayDwell();
 
-            this._useLongerNotificationLeftTimeout = false;
-            if (this._notificationLeftTimeoutId) {
-                Mainloop.source_remove(this._notificationLeftTimeoutId);
-                this._notificationLeftTimeoutId = 0;
-                this._notificationLeftMouseX = -1;
-                this._notificationLeftMouseY = -1;
-            }
+            this._resetNotificationLeftTimeout();
 
             if (this._showNotificationMouseX >= 0) {
                 let actorAtShowNotificationPosition =
@@ -2719,13 +2723,7 @@ const MessageTray = new Lang.Class({
             this._notificationUnfocusedId = 0;
         }
 
-        this._useLongerNotificationLeftTimeout = false;
-        if (this._notificationLeftTimeoutId) {
-            Mainloop.source_remove(this._notificationLeftTimeoutId);
-            this._notificationLeftTimeoutId = 0;
-            this._notificationLeftMouseX = -1;
-            this._notificationLeftMouseY = -1;
-        }
+        this._resetNotificationLeftTimeout();
 
         if (animate) {
             this._tween(this._notificationWidget, '_notificationState', State.HIDDEN,